package com.twang.stock.service.impl;

import com.twang.stock.entity.StockHotInfo;
import com.twang.stock.mapper.StockHotInfoMapper;
import com.twang.stock.service.IndexRiskService;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;

@Service
public class IndexRiskServiceImpl implements IndexRiskService {

    @Resource
    private StockHotInfoMapper stockHotInfoMapper;

    /**
     * 查询情况
     * @param modelAndView
     */
    @Override
    public void indexDataInit(ModelAndView modelAndView)   {
        List<StockHotInfo>  list=stockHotInfoMapper.selectDateNums();
        List mapList=new ArrayList<>();
        list.stream().forEach(item->{
            List arrayList=new ArrayList<>();
            arrayList.add(item.getDate());
            arrayList.add(item.getNum());
            mapList.add((arrayList));
        });
        modelAndView.addObject("mapLists",mapList);
    }
}
